// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file messData.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace {
char dummy;
}  // namespace
#endif  // _WIN32

#include "messData.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>

messData::messData()
{
    // m_header com.eprosima.idl.parser.typecode.PrimitiveTypeCode@51cdd8a
    m_header = 0;
    // m_index com.eprosima.idl.parser.typecode.PrimitiveTypeCode@d44fc21
    m_index = 0;
    // m_maxLimit com.eprosima.idl.parser.typecode.PrimitiveTypeCode@23faf8f2
    m_maxLimit = 0;
    // m_timeSec com.eprosima.idl.parser.typecode.PrimitiveTypeCode@2d6eabae
    m_timeSec = 0;
    // m_timeuSec com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4e7dc304
    m_timeuSec = 0;
    // m_metadata com.eprosima.idl.parser.typecode.SequenceTypeCode@64729b1e


}

messData::~messData()
{






}

messData::messData(
        const messData& x)
{
    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_metadata = x.m_metadata;
}

messData::messData(
        messData&& x)
{
    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_metadata = std::move(x.m_metadata);
}

messData& messData::operator =(
        const messData& x)
{

    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_metadata = x.m_metadata;

    return *this;
}

messData& messData::operator =(
        messData&& x)
{

    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_metadata = std::move(x.m_metadata);

    return *this;
}

size_t messData::getMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);




    return current_alignment - initial_alignment;
}

size_t messData::getCdrSerializedSize(
        const messData& data,
        size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    if (data.metadata().size() > 0)
    {
        current_alignment += (data.metadata().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
    }




    return current_alignment - initial_alignment;
}

void messData::serialize(
        eprosima::fastcdr::Cdr& scdr) const
{

    scdr << m_header;
    scdr << m_index;
    scdr << m_maxLimit;
    scdr << m_timeSec;
    scdr << m_timeuSec;
    scdr << m_metadata;

}

void messData::deserialize(
        eprosima::fastcdr::Cdr& dcdr)
{

    dcdr >> m_header;
    dcdr >> m_index;
    dcdr >> m_maxLimit;
    dcdr >> m_timeSec;
    dcdr >> m_timeuSec;
    dcdr >> m_metadata;
}

/*!
 * @brief This function sets a value in member header
 * @param _header New value for member header
 */
void messData::header(
        uint8_t _header)
{
    m_header = _header;
}

/*!
 * @brief This function returns the value of member header
 * @return Value of member header
 */
uint8_t messData::header() const
{
    return m_header;
}

/*!
 * @brief This function returns a reference to member header
 * @return Reference to member header
 */
uint8_t& messData::header()
{
    return m_header;
}

/*!
 * @brief This function sets a value in member index
 * @param _index New value for member index
 */
void messData::index(
        uint32_t _index)
{
    m_index = _index;
}

/*!
 * @brief This function returns the value of member index
 * @return Value of member index
 */
uint32_t messData::index() const
{
    return m_index;
}

/*!
 * @brief This function returns a reference to member index
 * @return Reference to member index
 */
uint32_t& messData::index()
{
    return m_index;
}

/*!
 * @brief This function sets a value in member maxLimit
 * @param _maxLimit New value for member maxLimit
 */
void messData::maxLimit(
        uint32_t _maxLimit)
{
    m_maxLimit = _maxLimit;
}

/*!
 * @brief This function returns the value of member maxLimit
 * @return Value of member maxLimit
 */
uint32_t messData::maxLimit() const
{
    return m_maxLimit;
}

/*!
 * @brief This function returns a reference to member maxLimit
 * @return Reference to member maxLimit
 */
uint32_t& messData::maxLimit()
{
    return m_maxLimit;
}

/*!
 * @brief This function sets a value in member timeSec
 * @param _timeSec New value for member timeSec
 */
void messData::timeSec(
        uint32_t _timeSec)
{
    m_timeSec = _timeSec;
}

/*!
 * @brief This function returns the value of member timeSec
 * @return Value of member timeSec
 */
uint32_t messData::timeSec() const
{
    return m_timeSec;
}

/*!
 * @brief This function returns a reference to member timeSec
 * @return Reference to member timeSec
 */
uint32_t& messData::timeSec()
{
    return m_timeSec;
}

/*!
 * @brief This function sets a value in member timeuSec
 * @param _timeuSec New value for member timeuSec
 */
void messData::timeuSec(
        uint32_t _timeuSec)
{
    m_timeuSec = _timeuSec;
}

/*!
 * @brief This function returns the value of member timeuSec
 * @return Value of member timeuSec
 */
uint32_t messData::timeuSec() const
{
    return m_timeuSec;
}

/*!
 * @brief This function returns a reference to member timeuSec
 * @return Reference to member timeuSec
 */
uint32_t& messData::timeuSec()
{
    return m_timeuSec;
}

/*!
 * @brief This function copies the value in member metadata
 * @param _metadata New value to be copied in member metadata
 */
void messData::metadata(
        const std::vector<uint8_t>& _metadata)
{
    m_metadata = _metadata;
}

/*!
 * @brief This function moves the value in member metadata
 * @param _metadata New value to be moved in member metadata
 */
void messData::metadata(
        std::vector<uint8_t>&& _metadata)
{
    m_metadata = std::move(_metadata);
}

/*!
 * @brief This function returns a constant reference to member metadata
 * @return Constant reference to member metadata
 */
const std::vector<uint8_t>& messData::metadata() const
{
    return m_metadata;
}

/*!
 * @brief This function returns a reference to member metadata
 * @return Reference to member metadata
 */
std::vector<uint8_t>& messData::metadata()
{
    return m_metadata;
}

size_t messData::getKeyMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t current_align = current_alignment;









    return current_align;
}

bool messData::isKeyDefined()
{
    return false;
}

void messData::serializeKey(
        eprosima::fastcdr::Cdr& scdr) const
{
    (void) scdr;
          
}
